This document describes the installation and use of one freely available environment that consists of:
running under MS-Windows.
mingw32-base
, mingw32-gcc-g++
,
and msys-base
. (You can install other components later,
if needed.)
If you want to use the make utility from within jGrasp you will also need to do the following:
bin
directory under the msys
directory. (The location
of which will vary depending on how you installed MSYS. One
possibility is c:\msys\1.0\bin
)
You are now ready to start developing in C/C++ and you have three ways to proceed, depending on your personal preferences. You can work from the standard command shell (using an editor of your choice), you can work from the MSYS shell (using an editor of your choice), or you can use jGrasp.
#include <iostream> int main(int argc, char **argv) { std::cout << "Testing 1, 2, 3\n"; return (0); }into the editing window.
testing.cpp
.Depending on what else is installed on your computer, this will either cause the message "Testing 1, 2, 3" to be written into the jGrasp Run I/O window or will open a command shell window and execute the program there.
The Build menu contains the entries Compile, Compile and Link, Make, and Run (among others). The Compile entry can be used to compile an individual source file. The Compile and Link entry is not very useful because the process of indicating which files should be linked is akward. Hence, it is best to use the Make entry.
The Make entry simply calls the
make utility (which must be
in your path -- see the discussion in the installation instructions above).
The make utility uses a makefile
(with a default name of makefile
) in the working directory.
You can, of course, create/edit this file with jGrasp.
Note that when you run an application from withing jGrasp it assumes that
the executable is named a.exe
.
cmd.exe
and command.com
provided
with MS-Windows) that allows you to develop
C++ programs as you would using a UNIX/Linux command shell.
You can start this command shell either by running the
msys.bat
file (e.g., in c:\msys\1.0\bin
).
For convenience, you may want to create a "shortcut" to
msys.bat
(right-click on the msys.bat
in
file explorer and pull down to Create Shortcut) and
put it on your desktop.
Once you have the shell running, you can use the text editor of your choice (e.g., VIM to create files, the G++ compiler to compile and link, and the GNU make utility to manage projects.
Note: By default, MSYS will create a "home" directory (that it will
start in) for you under the directory in which it was installed. To
use an alternative directory for your "home" you must set a Windows
environment variable named HOME
. For example, to use
the directory c:\users\bernstdh
set
HOME
to c:\users\bernstdh
from the
"Control Panel". (Your "home" directory is also where you would put your
.profile
file.)
cmd.exe
can be accessed
from the Start menu by choosing run
and entering cmd.exe
in the dialog box.
To use the MS-Windows shell to compile and link C++ programs
you need to have both the bin
under MinGW
(which may be something like c:\MinGW\bin
depending on
where you installed it)
and the bin
directory under MSYS
(which may be something like c:\msys\1.0\bin
depending on
where you installed it) in your PATH.
Once you have the shell running, you can use the text editor of your choice (e.g., VIM to create files, the G++ compiler to compile and link, and the GNU make utility to manage projects.
Copyright 2019